<?php 
/**
 * Description of form
 * @author diotheos
 * @since 7 мая 2010
 */
class App_Form_User_Login extends Zend_Form
{
    /**
     * Initialization of form function
     *
     * @since 7 мая 2010
     * @author diotheos
     * @return Zend_Form
     */
    public function init()
    {
        parent::init();

        $this->setMethod('post');
        $this->setAction('');

        $email = new Zend_Form_Element_Text('email');

        $email->setRequired()
                ->setLabel(_('Email:'))
                ->setFilters(array(
                                  'StringToLower',
                                  'StringTrim'
                             ))
                ->addValidators(array(
                                     array('NotEmpty', true),
                                     array('stringLength', false, array(6, 40)),
                                     new Zend_Validate_EmailAddress()
                                ));
        $email->addErrorMessage(_('Input valid email and password'));
        $this->addElement($email);

        $password = new Zend_Form_Element_Password('password');
        $password->setLabel(_('Password:'))
                ->setRequired()
                ->addValidators(array(
                                     array('NotEmpty', true),
                                     array('stringLength', false, array(6, 12)),
                                ));
        $password->addErrorMessage(_('Input valid email and password'));
        $this->addElement($password);

        $submit = new Zend_Form_Element_Submit('signin');
        $submit->setLabel(_('Get in'));
        $submit->clearDecorators();
        $submit->addDecorator('ViewHelper');
        $this->addElement($submit);
        //		$this->setDecorators(array(
        //            array('ViewScript', array('viewScript'=>'forms/user/login.phtml', 'class'=> 'form element'))
        //        ));
        return $this;
    }
}